import Vue from 'vue';
import VueRouter from 'vue-router';
import Index from '../views/Index';
import NullPage from '../views/NullPage.vue';
import AllRank from "../views/AllRank";
import Rank from "../views/Rank";
import SongSheetDetails from "../views/SongSheetDetails";
import Singers from "../views/Singers";
import SingerDetail from "../views/SingerDetail.vue";
import SearchPage from "../views/SearchPage.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    name: 'index',
    component: Index
  },
  {
    path: '/all-rank',
    name: 'all-rank',
    meta: {
      isBack: true
    },
    component: AllRank
  },
  {
    path: '/rank',
    name: 'rank',
    component: Rank
  },
  {
    path: '/song-sheet-details',
    name: 'song-sheet-details',
    component: SongSheetDetails
  },
  {
    path: '/singers',
    name: 'singers',
    meta: {
      isBack: false
    },
    component: Singers
  },
  {
    path: '/singersDetail',
    name: 'singersDetail',
    component: SingerDetail
  },
  {
    path: '/searchPage',
    name: 'searchPage',
    component: SearchPage
  },
  {
    path: '/null-page',
    name: 'null-page',
    component: NullPage
  }
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.NODE_ENV === 'production' ? '/wuhen_music/' : '/',
  routes
});

export default router;